import LoginForm from '../params/login'
import LoginServiceApi from '../api/loginServiceApi'
import { ServerResponse } from '@/util/base/ServerResponse'
import { LoginVo } from '../vo/loginVo'

export default class LoginService {
  loginServiceApi = new LoginServiceApi()

  // 获取验证码
  async captcha ():Promise<string> {
    const res:string = await this.loginServiceApi.captcha()
    return res
  }

  // 登录
  // 对登录返回值进行进一步解构
  async login (loginForm:LoginForm):Promise<ServerResponse<LoginVo>> {
    const res:ServerResponse<LoginVo> = await this.loginServiceApi.login(loginForm)
    return res
  }
}
